package com.kmxd.ams.app.event.efile;

import com.kmxd.ams.app.event.efile.command.EfilePathArrangeCmd;
import com.kmxd.ams.client.event.efile.EfilePathArrangeEvent;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.transaction.event.TransactionalEventListener;

/**
 * 归档整理功能
 *
 * @author ZuoLG
 */
@Slf4j
@Component
@AllArgsConstructor
public class EfilePathArrangeListener {

  private final EfilePathArrangeCmd archivingFileCmd;

  /**
   * 归档电子文件
   *
   * @param event
   * @throws Exception
   */
  @TransactionalEventListener(fallbackExecution = true)
  public void archivingFile(EfilePathArrangeEvent event) throws Exception {
    archivingFileCmd.archivingEfile(event.getReq());
  }
}
